import Vue from "vue";
import App from "@/App.vue";
import router from "@/router";
import store from "@/store";
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';

Vue.use(ElementUI);

// iView 完整引入
import iView from "iview";
import "iview/dist/styles/iview.css";
// 自定义组件引入
import iComp from "@/components";
// 工具函数引入
import Utils from "@/utils";
// 自定义组件引入
import vComp from "@/views/components";

// Mock 数据引入
import Mock from "@/mock";
// if (process.env.NODE_ENV === 'development') {
Mock();
// }

// 调用 `iView`
Vue.use(iView);
// 调用 `iComp`
Vue.use(iComp);
// 调用 `vComp`
Vue.use(vComp);



Vue.prototype.randomStr = function (len) {
  let str = "",
    arr = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
  // 随机产生，i为指定长度
  for (let i = 0; i < len; i++) {
    let pos = Math.round(Math.random() * (arr.length - 1));
    str += arr[pos];
  }
  return str;
}
// 判断是否有设备ID
if (localStorage.getItem("DeviceId")==null){
  localStorage.setItem("DeviceId",Vue.prototype.randomStr(50))
}
Vue.prototype.DeviceId=localStorage.getItem("DeviceId")
Vue.prototype.ApiUrl="http://videotest.kuaiyunma.com:9310/";

Object.defineProperty(Vue.prototype, "$Utils", {
  value: Utils
});

Vue.config.productionTip = false;


new Vue({
  router,
  store,
  render: h => h(App)
}).$mount("#app");
